<template>
  <template v-for="item in menu">
    <el-sub-menu :index="item.code" class="menuTree" v-if="item?.children && item?.children?.length">
      <template #title>
        <span class="el-sub-menu__title__span">
          {{ item?.name }}
        </span>
      </template>
      <menuTree :menu="item?.children"/>
    </el-sub-menu>
    <el-menu-item :index="item.code" v-else>
      <span>
        {{ item?.name }}
      </span>
    </el-menu-item>
  </template>
</template>

<script lang="ts">
export default {
  name: "menuTree"
}
</script>
<script setup lang="ts">

let {menu} = defineProps({
  menu:{
    type: Object,
    default: [] as any[]
  }
})
</script>
<style scoped>

</style>